<template>
    <div class="cart-list-item-container">
        <div class="cart-list-item-input">
            <input type="checkbox" 
            :checked="inpval"
            @change="radioinput"
            >
        </div>
        <div class="cart-list-item-img" >
            <img :src=item.pic alt="">
        </div>
        <div class="cart-list-item-title">
            <div class="cart-list-item-name">{{item.name}}</div>
            <div></div>
            <div class="cart-list-item-count-container">
                <div>￥{{item.minPrice}}</div>
                <div class="cart-list-item-count-wrapper">
                    <div @click="minuscount">-</div>
                    <div>{{item.count}}</div>
                    <div @click="onAddnum">+</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import '../css/cartcss/cart.css'
export default {
    props:{
        item:Object
    },
    methods:{
        radioinput(event){
            var radioinputval=event.target.checked
            this.$store.dispatch("radioinpval",{id:this.item.id,checked:radioinputval})
        },
        onAddnum(){
            this.$store.dispatch("addnum",this.item)
        },
        minuscount(){
            this.$store.dispatch("nummiu",this.item)
        }
    },
    mounted(){
        // window.console.log(this.item)
    },
    computed:{
        inpval:function(){
            return this.item.checked
        }
    }
}
</script>
<style>

</style>